from lxml import etree

xml = """
<dependency>
    <groupId>com.bill</groupId>
    <artifactId>aaa</artifactId>
    <version>2.0</version>
</dependency>
"""

# 将内容加载成etree
tree = etree.XML(xml)
# 加text()拿文泵
result = tree.xpath("/dependency/groupId/text()")
# //拿后代
result = tree.xpath("/dependency//groupId/text()")
# *通配符
result = tree.xpath("/dependency/*/groupId/text()")
print(result)


html = etree.parse("test.html")
reuslt1 = html.xpath("/html/body/ul[3]/li[1]/text()")
print(reuslt1)
